cmake_minimum_required(VERSION 2.6)
Project(wishmaster)
SET(CMAKE_VERBOSE_MAKEFILE OFF)
ADD_DEFINITIONS(${QT_DEFINITIONS} -DHAVE_CONFIG_H -DSQLITE_THREADSAFE=1)
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR}
					${CMAKE_CURRENT_BINARY_DIR}/libwm
					${CMAKE_CURRENT_BINARY_DIR}
					${CMAKE_SOURCE_DIR}/dicpp/include/ ${CMAKE_SOURCE_DIR}/libwm/
					${CMAKE_SOURCE_DIR}/libwm/ui)
LINK_DIRECTORIES(${QT_LIB_DIR})
set(QT_UIC_EXECUTABLE /usr/bin/uic)
set(QT_MOC_EXECUTABLE /usr/bin/moc)
FIND_PACKAGE(Qt4 REQUIRED)
SET(QT_USE_QTXML 1)
SET(QT_USE_QTUITOOLS 1)
SET(QT_USE_QTNETWORK 1)
SET(QT_USE_PHONON 1)
SET(QT_USE_QTTEST 1)
INCLUDE(${QT_USE_FILE})
FIND_PACKAGE(PkgConfig)
#SET(CMAKE_VERBOSE_MAKEFILE ON)
IF(PKG_CONFIG_FOUND)
	MESSAGE("-- pkgconfig found")
	PKG_CHECK_MODULES(HUNSPELL hunspell)
	PKG_CHECK_MODULES(CPPUNIT cppunit)
ENDIF(PKG_CONFIG_FOUND)

SET(CMAKE_CXX_FLAGS  "-O2 -Wall -pg --std=c++0x -fPIC")
SET(LINK_FLAGS "-O0 -g -pg")

IF(UNIX)
	ADD_DEFINITIONS(-DUNIX)
ELSEIF(WIN32 && !CYGWIN)
	ADD_DEFINITIONS(-DWIN32)
ENDIF(UNIX)

SET(BINDIR ${CMAKE_INSTALL_PREFIX}/bin)
SET(ROOTLIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
SET(LIBDIR ${CMAKE_INSTALL_PREFIX}/lib/wishmaster)
SET(SHAREDIR ${CMAKE_INSTALL_PREFIX}/share/wishmaster)

ADD_DEFINITIONS(-DINSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
IF(WISHMASTER_BUILD_TESTS)
	IF(CPPUNIT_FOUND)
		add_subdirectory(tests)
	ENDIF(CPPUNIT_FOUND)
	add_subdirectory(dicpp)
ENDIF(WISHMASTER_BUILD_TESTS)
add_subdirectory(plugins)
add_subdirectory(libwm)
add_subdirectory(wishmaster)

SET(sounds
	sounds/newmsg.wav)

INSTALL(FILES ${sounds} DESTINATION ${SHAREDIR}/sounds)

# CPack setup
SET(CPACK_GENERATOR "TGZ")
SET(CPACK_SOURCE_IGNORE_FILES "/CVS/;/.svn/;.swp$;.*~;.hg/;/build/;Makefile;.*tmp$;wishmaster.project;.*pro.user$;tags$;")
SET(CPACK_SOURCE_GENERATOR "TBZ2")
SET(CPACK_PACKAGE_NAME "wishmaster")
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "6")
SET(CPACK_PACKAGE_VERSION_PATCH "1")
INCLUDE(CPack)


